import { ExtractPropTypes } from "vue"
import { KeyboardLangMode, KeyboardLangModes } from "./type"

/**
 * props参数
 */
export const carKeyboardProps = {
  /** 切换中/英状态, 在mode为car时有效 */
  langMode: {
    type: String,
    default: (): KeyboardLangMode => {
      return 'en'
    },
    validator: (value: KeyboardLangMode) => {
      return KeyboardLangModes.includes(value)
    }
  }
}
export type CarKeyboardProps = ExtractPropTypes<typeof carKeyboardProps>

export const carKeyboardEmits = {
  change: (value: string | number) => typeof value === 'string' || typeof value === 'number',
  backspace: () => true,
  confirm: () => true
}
export type CarKeyboardEmits = typeof carKeyboardEmits
